<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'Add.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

	  <script type="text/javascript" src="/statics/js/jquery-1.12.4.js"></script>
	<script type="text/javascript">

        $(document).ready(function() {
			$("#save").click(function(){
                var stdnum=$("#stdnum").val();
                var zhname=$("#zhname").val();
                var ver=$("#ver").val();
                var keyes=$("#keyes").val();
                var releasedate=$("#releasedate").val();
                var impldate=$("#impldate").val();
                var packagepath=$("#packagepath").val();
                if(stdnum==""){
                    alert("标志号不能为空");
                }else if(zhname==""){
                    alert("中文号不能为空");
                }else if(ver==""){
                    alert("版本不能为空");
                }else if(keyes==""){
                    alert("关键字不能为空");
                }else{
                    $.ajax({
                        /*type:"POST",*/
                        url:"/user/addSave.html",
                        data:{
                            "stdnum": stdnum,
                            "zhname": zhname,
                            "ver": ver,
                            "keyes": keyes,
                            "releasedate": releasedate,
                            "impldate": impldate,
                            "packagepath": packagepath,
                        },
                        dataType:"JSON",
                        success : function (data) {
                            alert("增加成功！！");
                            window.location.href="${pageContext.request.contextPath }/user/show.html";
                        }
                    });
				}
            });
		})

	
	</script>
  </head>
  
  <body>
	<form action="" method="post"  enctype="multipart/form-data">
	<table border="1">
		<tr>
			<td class="no1">*标志号</td>
			<td><input type="text" class="text" id="stdnum" name="stdnum" /></td>
		</tr>
		<tr>
			<td class="no1">*中文号</td>
			<td><input type="text" class="text" id="zhname" name="zhname" /></td>
		</tr>
		<tr>
			<td class="no1">*版本</td>
			<td><input type="text" class="text" id="ver" name="ver" /></td>
		</tr>
		<tr>
			<td class="no1">*关键字</td>
			<td><input type="text" class="text" id="keyes" name="keyes" /></td>
		</tr>
		<tr>
			<td class="no1">发布日期（yyyy-MM-dd）</td>
			<td><input type="text" class="text" id="releasedate"
				name="releasedate" /></td>
		</tr>
		<tr>
			<td class="no1">实施日期（yyyy-MM-dd）</td>
			<td><input type="text" class="text" id="impldate"
				name="impldate" /></td>
		</tr>
		<tr>
			<td class="no1">*附件</td>
			<td><input type="file" class="text" id="packagepath"
				name="packagepath" value="" /></td>
		</tr>
		<tr>
			<td colspan="2" class="last"><input type="button" id="save"
				value="保存" /> <input type="button" id="back" value="取消" onclick="javascript:history.back(-1);"/></td>
		</tr>
	</table>
	<input type="hidden" id="nowStdNum" value="">
	</form>
   
  </body>
</html>
